Skip to content

Conversation

sommeeeer
Copy link
Collaborator

@sommeeeer sommeeeer commented Sep 1, 2025

This is for opennextjs/opennextjs-aws#969

We patch NextServer's attachRequestMeta as it will be called in handleRequestImpl. In theory we can also just comment out that line as we pass in initURL to nextServer.getRequestHandlerWithMetadata arguments already here when we process the request through NextServer.

Has been tested on Next 14 aswell.

I did update the tests that relied on this aswell.

Update: Turns out in pages router it relies on initURL to be this template string value. Reason is that it wont have the _next/data part in the initURL we passed in to the request handlers metadata, however it will be in req.url. Because of that I just updated the fix to only replace the protocol instead.

Copy link

changeset-bot bot commented Sep 1, 2025

🦋 Changeset detected

Latest commit: 148d057

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@opennextjs/cloudflare Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

pkg-pr-new bot commented Sep 1, 2025

Open in StackBlitz

npm i https://pkg.pr.new/@opennextjs/cloudflare@865

commit: 148d057

@sommeeeer sommeeeer marked this pull request as draft September 1, 2025 19:24
@sommeeeer sommeeeer marked this pull request as ready for review September 1, 2025 20:14
Copy link
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @sommeeeer for fixing this long standing issue.

I have added a couple of minor comments inline. The PR is good to go when those are addressed.

Edit: and kudos for the PR description too. Adding context is super helpful to ease the review 🙏

@sommeeeer
Copy link
Collaborator Author

Thanks for the review Victor!

@sommeeeer sommeeeer merged commit f1e9457 into opennextjs:main Sep 2, 2025
6 checks passed
@sommeeeer sommeeeer deleted the fix-request-url branch September 2, 2025 17:07
@sommeeeer sommeeeer changed the title add(patch): Ensure request.url is with correct protocol in route handlers fix(patch): Ensure request.url is with correct protocol in route handlers Sep 2, 2025
@sommeeeer sommeeeer changed the title fix(patch): Ensure request.url is with correct protocol in route handlers fix: Ensure request.url is with correct protocol in route handlers Sep 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants